#include "PortStruct.h"

PortStruct::PortStruct()
{
    m_port = 0;
}

QString PortStruct::type() const
{
    return m_type;
}

void PortStruct::setType(const QString &type)
{
    m_type = type;
}


QString PortStruct::name() const
{
    return m_name;
}

void PortStruct::setName(const QString &name)
{
    m_name = name;
}

QString PortStruct::ip() const
{
    return m_ip;
}

void PortStruct::setIp(const QString &ip)
{
    m_ip = ip;
}
quint16 PortStruct::port() const
{
    return m_port;
}

void PortStruct::setPort(const quint16 &port)
{
    m_port = port;
}

QString PortStruct::portName() const
{
    return m_portName;
}

void PortStruct::setPortName(const QString &portName)
{
    m_portName = portName;
}
QString PortStruct::mode() const
{
    return m_mode;
}

void PortStruct::setMode(const QString &mode)
{
    m_mode = mode;
}
QString PortStruct::baudRate() const
{
    return m_baudRate;
}

void PortStruct::setBaudRate(const QString &baudRate)
{
    m_baudRate = baudRate;
}
QString PortStruct::dataBits() const
{
    return m_dataBits;
}

void PortStruct::setDataBits(const QString &dataBits)
{
    m_dataBits = dataBits;
}
QString PortStruct::parity() const
{
    return m_parity;
}

void PortStruct::setParity(const QString &parity)
{
    m_parity = parity;
}
QString PortStruct::stopBits() const
{
    return m_stopBits;
}

void PortStruct::setStopBits(const QString &stopBits)
{
    m_stopBits = stopBits;
}
QString PortStruct::flowControl() const
{
    return m_flowControl;
}

void PortStruct::setFlowControl(const QString &flowControl)
{
    m_flowControl = flowControl;
}
QString PortStruct::enablePinNumber() const
{
    return m_enablePinNumber;
}

void PortStruct::setEnablePinNumber(const QString &enablePinNumber)
{
    m_enablePinNumber = enablePinNumber;
}


bool PortStruct::operator ==(const PortStruct &rhs)  //重载相等
{
    return(m_ip == rhs.ip()) && (m_port == rhs.port());
}



QDebug operator <<(QDebug debug, const PortStruct &port)
{
    if(port.type() != "UART")
    {
        debug<<"PortName"<<port.name()<<"IP:"<<port.ip()<<"Port:"<<port.port();
    }
    else
    {
        debug<<"PortName"<<port.name();
    }
    return debug;
}


